package cn.itcast.controller.company;


import cn.itcast.domain.company.Company;
import cn.itcast.service.company.CompanyService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.UUID;

@Controller
public class CompanyController {

    @Reference
    private CompanyService companyService;


    @RequestMapping(value = "/apply", name = "前端企业信息保存")
    @ResponseBody
    public String save(Company company) {
        try {


            company.setId(UUID.randomUUID().toString().replaceAll("-", ""));
            company.setState(0);
            companyService.save(company);
            return "1";
        } catch (Exception e) {
            e.printStackTrace();
            return "0";
        }

    }
}
